﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:local="clr-namespace:EIA.SLClient.PlatManage.PMMgr"
	xmlns:EIA_SLClient_Utility="clr-namespace:EIA.SLClient.Utility;assembly=EIA.SLClient.Utility" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
	mc:Ignorable="d"
	x:Class="EIA.SLClient.PlatManage.PMMgr.EngineerListView"
	d:DesignWidth="640" d:DesignHeight="480">
	<UserControl.Resources>
		<local:EngineerListViewModel x:Key="EngineerListViewModelDataSource" />
		<DataTemplate x:Key="OptDataTemplate">
			<StackPanel d:DesignWidth="100" Orientation="Horizontal">
				<HyperlinkButton Content="编辑" CommandParameter="{Binding}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="8,0" BorderThickness="0">
					<EIA_SLClient_Utility:BindingHelper.AncestorBinding>
						<EIA_SLClient_Utility:AncestorBinding TargetPath="Command" AncestorPath="DataContext.UpdateItemCommand" AncestorTypeName="DataGrid"/>
					</EIA_SLClient_Utility:BindingHelper.AncestorBinding>
				</HyperlinkButton>
				<HyperlinkButton Content="删除" CommandParameter="{Binding}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="8,0">
					<EIA_SLClient_Utility:BindingHelper.AncestorBinding>
						<EIA_SLClient_Utility:AncestorBinding TargetPath="Command" AncestorPath="DataContext.DeleteItemCommand" AncestorTypeName="DataGrid"/>
					</EIA_SLClient_Utility:BindingHelper.AncestorBinding>
				</HyperlinkButton>
			</StackPanel>
		</DataTemplate>
	</UserControl.Resources>
	<UserControl.FontSize>
		<StaticResource ResourceKey="FontSize"/>
	</UserControl.FontSize>
	<UserControl.FontFamily>
		<StaticResource ResourceKey="FontFamily"/>
	</UserControl.FontFamily>

	<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource EngineerListViewModelDataSource}}">
		<Grid Margin="4" Background="#FFF2F2F2">
			<Grid.Effect>
				<DropShadowEffect BlurRadius="1" ShadowDepth="1" Opacity="0.1"/>
			</Grid.Effect>
			<Grid.RowDefinitions>
				<RowDefinition Height="32"/>
				<RowDefinition/>
				<RowDefinition Height="32"/>
			</Grid.RowDefinitions>
			<i:Interaction.Triggers>
				<i:EventTrigger>
					<ei:CallMethodAction TargetObject="{Binding Mode=OneWay}" MethodName="OnLoad"/>
				</i:EventTrigger>
			</i:Interaction.Triggers>
			<Border BorderBrush="#FFE1E1E1" BorderThickness="1">
				<Border.Background>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FFFCFCFC" Offset="0"/>
						<GradientStop Color="#FFEBEBEB" Offset="1"/>
					</LinearGradientBrush>
				</Border.Background>
				<Grid>
					<HyperlinkButton Content="添加" Command="{Binding InsertItemCommand}" HorizontalAlignment="Left" Margin="8,0,0,0" VerticalAlignment="Center" />
					<HyperlinkButton Content="重新载入" Command="{Binding RetrieveItemsCommand}" HorizontalAlignment="Right" Margin="0,0,8,0" VerticalAlignment="Center" />
				</Grid>
			</Border>
			<Border BorderBrush="#FFE1E1E1" BorderThickness="1,0" Grid.Row="1">
				<Grid>
					<sdk:DataGrid ItemsSource="{Binding EngineerCollection}">
						<sdk:DataGrid.Columns>
							<sdk:DataGridTextColumn Header="姓名" MinWidth="120" Binding="{Binding StfName}" CanUserSort="True" />
							<sdk:DataGridTextColumn Header="行业" MinWidth="160" Binding="{Binding EngAlias}" CanUserSort="True" />
							<sdk:DataGridTemplateColumn Header="操作" CellTemplate="{StaticResource OptDataTemplate}"/>
						</sdk:DataGrid.Columns>
					</sdk:DataGrid>
				</Grid>
			</Border>
			<Border BorderBrush="#FFE1E1E1" BorderThickness="1" Grid.Row="2" Background="WhiteSmoke">
				<Grid/>
			</Border>
		</Grid>
	</Grid>
</UserControl>
